package com.lrl.security.dto;

import com.fasterxml.jackson.annotation.JsonView;
import com.lrl.security.validator.MyConstraint;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;
import javax.validation.constraints.Past;
import java.util.Date;

/**
 * @author LRL
 */
@Data
public class User {

    @JsonView(UserSimpleView.class)
    private int id;

    @ApiModelProperty(value = "用户名")
    @MyConstraint(message = "注解测试")
    @JsonView(UserSimpleView.class)
    private String username;

    @ApiModelProperty(value = "密码")
    @NotBlank(message = "密码不能为空！")
    @JsonView({UserDetailView.class})
    private String password;

    @ApiModelProperty(value = "生日")
    @Past(message = "生日必须为过去时间段")
    @JsonView(UserSimpleView.class)
    private Date birthday;

    public interface UserSimpleView{};
    public interface UserDetailView extends UserSimpleView{};

}
